﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GestureLib;
using System.Windows.Forms;

namespace GesturePad
{
    class WriteEditorTextAction : IGestureAction
    {
        public enum LetterCase
        { 
            Upper,
            Lower
        }

        public static LetterCase Case { get; set; }

        public TextBoxBase TextBox { get; set; }
        public string Text { get; set; }

        #region IGestureAction Members

        public void Execute()
        {
            string text = Text;

            switch (Case)
            {
                case LetterCase.Upper:
                    text = text.ToUpper();
                    break;
                case LetterCase.Lower:
                    text = text.ToLower();
                    break;
                default:
                    throw new NotImplementedException("This LetterCase is not implemented yet!");
            }

            TextBox.Text = TextBox.Text.Insert(TextBox.SelectionStart, text);
            TextBox.SelectionStart = TextBox.Text.Length;
        }

        #endregion

        #region INamed Members

        public string Name { get; set; }

        #endregion
    }
}
